#ifndef TextRecord_H
#define TextRecord_H

#include <vector>
#include <tinyxml.h>
#include "type.h"
#include "Color.h"
#include "GlyphEntry.h"

namespace swfstream {
class TextRecord: public SwfObject {
	//private:bool is_rgba;
public:
	bool is_rgba;
	//TextRecordType UB[1] Always 1.
	//StyleFlagsReserved UB[3] Always 0.
	bool StyleFlagsHasFont; ///< UB[1] 1 if text font specified.
	bool StyleFlagsHasColor; ///< UB[1] 1 if text color specified.
	bool StyleFlagsHasYOffset; ///< UB[1] 1 if y offset specified.
	bool StyleFlagsHasXOffset; ///< UB[1] 1 if x offset specified.
	uint16 FontID; ///< If StyleFlagsHasFont, UI16 Font ID for following text.
	Color *TextColor; ///< If StyleFlagsHasColor, RGB If this record is part of a DefineText2 tag,  RGBA Font color for following text.
	int16 XOffset; ///< If StyleFlagsHasXOffset, SI16 x offset for following text.
	int16 YOffset; ///< If StyleFlagsHasYOffset, SI16 y offset for following text.
	uint16 TextHeight; ///< If hasFont, UI16 Font height for following text.
	uint8 GlyphCount; ///< UI8 Number of glyphs in record.
	std::vector<GlyphEntry*>* GlyphEntries; ///< GLYPHENTRY[GlyphCount] Glyph entry (see following).
	void print();
	static TextRecord* from_file(FILE*, bool, int, int);
	static std::vector<TextRecord*>* list_from_file(FILE*, bool, int, int);
	virtual TiXmlElement* toTiXmlElement();
};
}

#endif
